@extends('layouts.app', ['active' => 2])

@section('title')系统日志 -
@endsection
@section('content')

            <div class="panel panel-default">
                <div class="panel-heading"><i class="fa fa-align-justify"></i> 日志
                </div>
                <div class="panel-body">
                  <div class="row" style="margin-bottom:10px">
                    <div class="col-md-6 text-left">
                      <form class="form-inline" action="{{ url('person/') }}" method="POST">
                        <div class="form-group">
                          <label class="sr-only" for="exampleInputPassword3">手机号</label>
                          <!--<select class="form-control" id="batch_type">
                            <option value="#delete_modal">操作</option>
                          </select>-->
                        </div>
                       <!-- <button type="button" data-toggle="modal" class="btn btn-default" data-action="" data-target="#delete_modal">应用</button>-->
                      </form>
                    </div>

                      <div class="col-md-6 text-right">
                        <form class="form-inline" action="" method="GET">
                          <div class="form-group">
                            <label class="sr-only" for="keyword">手机号</label>
                            <input type="text" class="form-control input-sm" name="keyword" id="keyword" placeholder="方法名">
                          </div>
                          <button type="submit" class="btn btn-primary btn-sm" title="搜索"><i class="fa fa-search" aria-hidden="true"></i></button>
                        </form>
                      </div>
                  </div>

                  <table class="table table-hover table-border table-condensed table-striped table-bordered">
                        <thead class="">
                          <tr>
                            <th><input type="checkbox" id="select_all"/></th>
                            <th>名称</th>
                            <th>路由</th>
                            <th>方法</th>
                            <th>用户</th>
                              <th>IP</th>
                              <th>日期</th>
                              <th >操作</th>
                          </tr>
                        </thead>
                        <tbody>
                          @foreach ($logs as $log)
                          <tr>
                            <td><input type="checkbox" name="ids" value="{{ $log->id }}"/></td>
                            <td>{{ $log->name }}</td>
                            <td>{{ $log->path }}</td>
                            <td>{{ $log->method }}</td>
                            <td>{{ $log->user }}</td>
                              <td>{{ long2ip($log->ip) }}</td>
                              <td>{{ $log->created_at }}</td>
                              <td style="text-align: center">
                                  <a href="javascript:;" class="model_recycle" data-id="9955" data-toggle="modal" data-target="#delete_modal" title="移至回收站"><i class="fa fa-trash-o"></i> </a>
                              </td>
                            </td>
                          </tr>
                          @endforeach
                        </tbody>
                      </table>
                    <div style="text-align:right;padding:0 0 10px;">

                    </div>
                    <div style="float:right">
                        <div class="pull-left">
                      {{ $logs->links() }}
                        </div>
                    </div>
                </div>
            </div>



@endsection

@section('script')
<script>
  $(function(){
    $('#batch_delete').click(function(){
        var ids = [];
        $("input[name='ids']").each(function() {
            if ($(this).prop('checked') == true) {
                ids.push($(this).val());
            }
        });
        ids = ids.join(",");
        if (ids == '') {
            alert('请至少选择一个人员');
            return false;
        }

    });
    $('#select_all').change(function(){
      //alert($(this).prop("checked"));
      $("input[name='ids']").prop("checked", $(this).prop("checked"));
        var ids = [];
        $("input[name='ids']").each(function() {
            if ($(this).prop('checked') == true) {
                ids.push($(this).val());
            }
        });
        ids = ids.join(",");
        //alert(ids);
        $('#batch_delete').attr("data-action", "{{ url('person') }}/" + ids);



    });
      $("input[name='ids']").change(function(){
          var ids = [];
          $("input[name='ids']").each(function() {
              if ($(this).prop('checked') == true) {
                  ids.push($(this).val());
              }
          });
          ids = ids.join(",");
          //alert(ids);
          $('#batch_delete').attr("data-action", "{{ url('person') }}/" + ids);

      });

      // 禁用管理员用户
      $(".forbid_link").click(function(){
          //$("p").slideToggle();
          $(this).next().submit();
          return false;
      });






  });

</script>
@endsection
